confmat_224=[conf_1_2(224);conf_1_3(224);conf_1_4(224);conf_2_3(224);conf_2_4(224);conf_3_4(224)]
predmat_224=[ypred_1_2(224);ypred_1_3(224);ypred_1_4(224);ypred_2_3(224);ypred_2_4(224);ypred_3_4(224)]

prob12=fld2prob1(conf_1_2);
prob13=fld2prob1(conf_1_3);
prob14=fld2prob1(conf_1_4);
prob23=fld2prob1(conf_2_3);
prob24=fld2prob1(conf_2_4);
prob34=fld2prob1(conf_3_4);
[prob12(224);prob13(224);prob14(224);prob23(224);prob24(224);prob34(224)]


temp_reg_features_cell=res.reg_features_cell{2}{3};
        temp_X = [temp_reg_features_cell.reg_loc_mat;
            temp_reg_features_cell.reg_text_mat;
            temp_reg_features_cell.reg_color_mat;
            temp_reg_features_cell.reg_geom_mat;
            temp_reg_features_cell.reg_shape_mat];

wall_ft=temp_X(:,123);
comb=[models_struct.model_1.W.*wall_ft];
figure;plot(comb,'b.')

for i=1:5,for j=1:3,figure;imagesc(res.reg_features_cell{i}{j}.reg_map);title(sprintf('hyp %d %d',i,j));pixval;,end,end

[x,y]=ginput(1);
x=round(x);
y=round(y);
kk=0;
for i=1:5,
    for j=1:3,
        kk=kk+1;
        reg_ind=res2.reg_features_cell{i}{j}.reg_map(y,x);
        ballot(kk)=vote_per_reg_cell2{i}{j}(reg_ind);
        conf(kk)=confidence_cell2{i}{j}(reg_ind);
    end
end


% count=1000;
% hypo=10;
% place=1000;
% for k=1:9
% indices=reg_indices_cell{2,1}{1,1};
% for mm=1:length(indices)
% nnn=length(indices{mm});
% if (nnn<50) 
%     count=nnn
%     %hypo=k
%     place=mm
% end
% end
% end
% 
%         for j=1:length(reg)
%             indices=seg_indices{1,reg(j)};
%                         if (length(indices)<20)
%                 bbb=j
%             end
% 
%             temp_reg_map(indices)=i;
%         end




saved_data{2,1}(1,:)= saved_data{2,1}(2,:);
saved_data{2,1}(:,1)= saved_data{2,1}(:,2);

 [models_struct,raw_data,model_results,is_nan]=create_models_from_images('mat files/868_1.mat','mat files/870_1.mat',...
'mat files/933_1.mat','mat files/945_1.mat','mat files/another_valley.mat','mat files/carmel_sky.mat','mat files/death_valley.mat',...
'mat files/green_valley.mat','mat files/haifa_s.mat','mat files/haifa_s_2.mat','mat files/jerusalem_1.mat','mat files/monfort_sky.mat',...
'mat files/Norway.mat','mat files/Rooftops.mat','mat files/Saloniki_Rooftops.mat','mat files/Sky_only_1.mat','mat files/village_1.mat');

mdir='D:\Technion\current semester\project A\Image Database - final\mix_dechiper_set';
zz=dir([mdir '\*.mat']);
str='';,for i=1:length(zz),str=sprintf('%s,''%s''',str,fullfile(mdir,zz(i).name));,end;,str(1)=[];
eval(sprintf(' [models_struct,raw_data,model_results,is_nan]=create_models_from_images(%s);',str))

run parameters
parameters.label_p=label_p;
parameters.model_p=model_p;
parameters.segment_p=segment_p;
clear label_p;
clear model_p;
clear segment_p;


gt_streets01=saved_data{2};
[streets01_using_country]=image_labels(streets01,models_struct_country);
[streets01_using_people]=image_labels(streets01,models_struct_people);
[streets01_using_mix]=image_labels(streets01,models_struct_mix);
[stat_streets01_with_country] = image_check_result(gt_streets01,streets01_using_country, 1);
[stat_streets01_with_mix] = image_check_result(gt_streets01,streets01_using_mix, 1);


[segment_labels_map1,res1,vote_per_reg_cell1,confidence_cell1]=image_labels(scenery15,models_struct);
[segment_labels_map2,res2,vote_per_reg_cell2,confidence_cell2]=image_labels(field01,models_struct);
for i=1:17
reg_indices_cell{i,1}.reg_indices=model_results{i,1}.reg_indices;
end
map=model_results{pic}.reg_features_cell{1}{1}.reg_map;

%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

alley07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.mat');
gt_alley07=saved_data.saved_data{2};
[alley07_using_country]=image_labels(alley07,models_struct_country);
[alley07_using_people]=image_labels(alley07,models_struct_people);
[alley07_using_mix]=image_labels(alley07,models_struct_mix);
a='alley07'
[stat_alley07_with_country] = image_check_result(gt_alley07,alley07_using_country, 1);
[stat_alley07_with_people] = image_check_result(gt_alley07,alley07_using_people, 1);
[stat_alley07_with_mix] = image_check_result(gt_alley07,alley07_using_mix, 1);

beach02=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.mat');
gt_beach02=saved_data.saved_data{2};
[beach02_using_country]=image_labels(beach02,models_struct_country);
[beach02_using_people]=image_labels(beach02,models_struct_people);
[beach02_using_mix]=image_labels(beach02,models_struct_mix);
a='beach02'
[stat_beach02_with_country] = image_check_result(gt_beach02,beach02_using_country, 1);
[stat_beach02_with_people] = image_check_result(gt_beach02,beach02_using_people, 1);
[stat_beach02_with_mix] = image_check_result(gt_beach02,beach02_using_mix, 1);

outdoor71=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.mat');
gt_outdoor71=saved_data.saved_data{2};
[outdoor71_using_country]=image_labels(outdoor71,models_struct_country);
[outdoor71_using_people]=image_labels(outdoor71,models_struct_people);
[outdoor71_using_mix]=image_labels(outdoor71,models_struct_mix);
a='outdoor71'
[stat_outdoor71_with_country] = image_check_result(gt_outdoor71,outdoor71_using_country, 1);
[stat_outdoor71_with_people] = image_check_result(gt_outdoor71,outdoor71_using_people, 1);
[stat_outdoor71_with_mix] = image_check_result(gt_outdoor71,outdoor71_using_mix, 1);

scenery07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.mat');
gt_scenery07=saved_data.saved_data{2};
[scenery07_using_country]=image_labels(scenery07,models_struct_country);
[scenery07_using_people]=image_labels(scenery07,models_struct_people);
[scenery07_using_mix]=image_labels(scenery07,models_struct_mix);
a='scenery07'
[stat_scenery07_with_country] = image_check_result(gt_scenery07,scenery07_using_country, 1);
[stat_scenery07_with_people] = image_check_result(gt_scenery07,scenery07_using_people, 1);
[stat_scenery07_with_mix] = image_check_result(gt_scenery07,scenery07_using_mix, 1);

urban8=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.mat');
gt_urban8=saved_data.saved_data{2};
[urban8_using_country]=image_labels(urban8,models_struct_country);
[urban8_using_people]=image_labels(urban8,models_struct_people);
[urban8_using_mix]=image_labels(urban8,models_struct_mix);
a='urban8'
[stat_urban8_with_country] = image_check_result(gt_urban8,urban8_using_country, 1);
[stat_urban8_with_people] = image_check_result(gt_urban8,urban8_using_people, 1);
[stat_urban8_with_mix] = image_check_result(gt_urban8,urban8_using_mix, 1);

streets01=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.mat');
gt_streets01=saved_data.saved_data{2};
[streets01_using_country]=image_labels(streets01,models_struct_country);
[streets01_using_people]=image_labels(streets01,models_struct_people);
[streets01_using_mix]=image_labels(streets01,models_struct_mix);
a='streets01'
[stat_streets01_with_country] = image_check_result(gt_streets01,streets01_using_country, 1);
[stat_streets01_with_people] = image_check_result(gt_streets01,streets01_using_people, 1);
[stat_streets01_with_mix] = image_check_result(gt_streets01,streets01_using_mix, 1);

 [models_struct_alley07,raw_data_alley07,model_results,is_nan]=create_models_from_images('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.mat');
 [models_struct_beach02,raw_data_beach02,model_results,is_nan]=create_models_from_images('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.mat');
 [models_struct_outdoor71,raw_data_outdoor71,model_results,is_nan]=create_models_from_images('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.mat');
 [models_struct_scenery07,raw_data_scenery07,model_results,is_nan]=create_models_from_images('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.mat');
 [models_struct_urban8,raw_data_urban8,model_results,is_nan]=create_models_from_images('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.mat');
 [models_struct_streets01,raw_data_streets01,model_results,is_nan]=create_models_from_images('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.mat');

run parameters
raw_data_country_with_alley07.input=[raw_data_country.input raw_data_alley07.input];
raw_data_country_with_alley07.list_of_regions=[raw_data_country.list_of_regions raw_data_alley07.list_of_regions];
[models_struct_country_with_alley07,is_nan] = create_models_struct( raw_data_country_with_alley07.input, raw_data_country_with_alley07.list_of_regions);
raw_data_people_with_alley07.input=[raw_data_people.input raw_data_alley07.input];
raw_data_people_with_alley07.list_of_regions=[raw_data_people.list_of_regions raw_data_alley07.list_of_regions];
[models_struct_people_with_alley07, is_nan] = create_models_struct( raw_data_people_with_alley07.input, raw_data_people_with_alley07.list_of_regions);
raw_data_mix_with_alley07.input=[raw_data_mix.input raw_data_alley07.input];
raw_data_mix_with_alley07.list_of_regions=[raw_data_mix.list_of_regions raw_data_alley07.list_of_regions];
[models_struct_mix_with_alley07, is_nan] = create_models_struct( raw_data_mix_with_alley07.input, raw_data_mix_with_alley07.list_of_regions);

raw_data_country_with_beach02.input=[raw_data_country.input raw_data_beach02.input];
raw_data_country_with_beach02.list_of_regions=[raw_data_country.list_of_regions raw_data_beach02.list_of_regions];
[models_struct_country_with_beach02, is_nan] = create_models_struct( raw_data_country_with_beach02.input, raw_data_country_with_beach02.list_of_regions);
raw_data_people_with_beach02.input=[raw_data_people.input raw_data_beach02.input];
raw_data_people_with_beach02.list_of_regions=[raw_data_people.list_of_regions raw_data_beach02.list_of_regions];
[models_struct_people_with_beach02, is_nan] = create_models_struct( raw_data_people_with_beach02.input, raw_data_people_with_beach02.list_of_regions);
raw_data_mix_with_beach02.input=[raw_data_mix.input raw_data_beach02.input];
raw_data_mix_with_beach02.list_of_regions=[raw_data_mix.list_of_regions raw_data_beach02.list_of_regions];
[models_struct_mix_with_beach02, is_nan] = create_models_struct( raw_data_mix_with_beach02.input, raw_data_mix_with_beach02.list_of_regions);

raw_data_country_with_outdoor71.input=[raw_data_country.input raw_data_outdoor71.input];
raw_data_country_with_outdoor71.list_of_regions=[raw_data_country.list_of_regions raw_data_outdoor71.list_of_regions];
[models_struct_country_with_outdoor71, is_nan] = create_models_struct( raw_data_country_with_outdoor71.input, raw_data_country_with_outdoor71.list_of_regions);
raw_data_people_with_outdoor71.input=[raw_data_people.input raw_data_outdoor71.input];
raw_data_people_with_outdoor71.list_of_regions=[raw_data_people.list_of_regions raw_data_outdoor71.list_of_regions];
[models_struct_people_with_outdoor71, is_nan] = create_models_struct( raw_data_people_with_outdoor71.input, raw_data_people_with_outdoor71.list_of_regions);
raw_data_mix_with_outdoor71.input=[raw_data_mix.input raw_data_outdoor71.input];
raw_data_mix_with_outdoor71.list_of_regions=[raw_data_mix.list_of_regions raw_data_outdoor71.list_of_regions];
[models_struct_mix_with_outdoor71, is_nan] = create_models_struct( raw_data_mix_with_outdoor71.input, raw_data_mix_with_outdoor71.list_of_regions);

raw_data_country_with_scenery07.input=[raw_data_country.input raw_data_scenery07.input];
raw_data_country_with_scenery07.list_of_regions=[raw_data_country.list_of_regions raw_data_scenery07.list_of_regions];
[models_struct_country_with_scenery07, is_nan] = create_models_struct( raw_data_country_with_scenery07.input, raw_data_country_with_scenery07.list_of_regions);
raw_data_people_with_scenery07.input=[raw_data_people.input raw_data_scenery07.input];
raw_data_people_with_scenery07.list_of_regions=[raw_data_people.list_of_regions raw_data_scenery07.list_of_regions];
[models_struct_people_with_scenery07, is_nan] = create_models_struct( raw_data_people_with_scenery07.input, raw_data_people_with_scenery07.list_of_regions);
raw_data_mix_with_scenery07.input=[raw_data_mix.input raw_data_scenery07.input];
raw_data_mix_with_scenery07.list_of_regions=[raw_data_mix.list_of_regions raw_data_scenery07.list_of_regions];
[models_struct_mix_with_scenery07, is_nan] = create_models_struct( raw_data_mix_with_scenery07.input, raw_data_mix_with_scenery07.list_of_regions);

raw_data_country_with_urban8.input=[raw_data_country.input raw_data_urban8.input];
raw_data_country_with_urban8.list_of_regions=[raw_data_country.list_of_regions raw_data_urban8.list_of_regions];
[models_struct_country_with_urban8, is_nan] = create_models_struct( raw_data_country_with_urban8.input, raw_data_country_with_urban8.list_of_regions);
raw_data_people_with_urban8.input=[raw_data_people.input raw_data_urban8.input];
raw_data_people_with_urban8.list_of_regions=[raw_data_people.list_of_regions raw_data_urban8.list_of_regions];
[models_struct_people_with_urban8, is_nan] = create_models_struct( raw_data_people_with_urban8.input, raw_data_people_with_urban8.list_of_regions);
raw_data_mix_with_urban8.input=[raw_data_mix.input raw_data_urban8.input];
raw_data_mix_with_urban8.list_of_regions=[raw_data_mix.list_of_regions raw_data_urban8.list_of_regions];
[models_struct_mix_with_urban8, is_nan] = create_models_struct( raw_data_mix_with_urban8.input, raw_data_mix_with_urban8.list_of_regions);

raw_data_country_with_streets01.input=[raw_data_country.input raw_data_streets01.input];
raw_data_country_with_streets01.list_of_regions=[raw_data_country.list_of_regions raw_data_streets01.list_of_regions];
[models_struct_country_with_streets01, is_nan] = create_models_struct( raw_data_country_with_streets01.input, raw_data_country_with_streets01.list_of_regions);
raw_data_people_with_streets01.input=[raw_data_people.input raw_data_streets01.input];
raw_data_people_with_streets01.list_of_regions=[raw_data_people.list_of_regions raw_data_streets01.list_of_regions];
[models_struct_people_with_streets01, is_nan] = create_models_struct( raw_data_people_with_streets01.input, raw_data_people_with_streets01.list_of_regions);
raw_data_mix_with_streets01.input=[raw_data_mix.input raw_data_streets01.input];
raw_data_mix_with_streets01.list_of_regions=[raw_data_mix.list_of_regions raw_data_streets01.list_of_regions];
[models_struct_mix_with_streets01, is_nan] = create_models_struct( raw_data_mix_with_streets01.input, raw_data_mix_with_streets01.list_of_regions);

alley07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.mat');
gt_alley07=saved_data.saved_data{2};
[alley07_using_country_with_alley07]=image_labels(alley07,models_struct_country_with_alley07);
[alley07_using_people_with_alley07]=image_labels(alley07,models_struct_people_with_alley07);
[alley07_using_mix_with_alley07]=image_labels(alley07,models_struct_mix_with_alley07);
a='alley07'
[stat_alley07_with_country_with_alley07] = image_check_result(gt_alley07,alley07_using_country_with_alley07, 1);
[stat_alley07_with_people_with_alley07] = image_check_result(gt_alley07,alley07_using_people_with_alley07, 1);
[stat_alley07_with_mix_with_alley07] = image_check_result(gt_alley07,alley07_using_mix_with_alley07, 1);

beach02=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.mat');
gt_beach02=saved_data.saved_data{2};
[beach02_using_country_with_beach02]=image_labels(beach02,models_struct_country_with_beach02);
[beach02_using_people_with_beach02]=image_labels(beach02,models_struct_people_with_beach02);
[beach02_using_mix_with_beach02]=image_labels(beach02,models_struct_mix_with_beach02);
a='beach02'
[stat_beach02_with_country_with_beach02] = image_check_result(gt_beach02,beach02_using_country_with_beach02, 1);
[stat_beach02_with_people_with_beach02] = image_check_result(gt_beach02,beach02_using_people_with_beach02, 1);
[stat_beach02_with_mix_with_beach02] = image_check_result(gt_beach02,beach02_using_mix_with_beach02, 1);

outdoor71=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.mat');
gt_outdoor71=saved_data.saved_data{2};
[outdoor71_using_country_with_outdoor71]=image_labels(outdoor71,models_struct_country_with_outdoor71);
[outdoor71_using_people_with_outdoor71]=image_labels(outdoor71,models_struct_people_with_outdoor71);
[outdoor71_using_mix_with_outdoor71]=image_labels(outdoor71,models_struct_mix_with_outdoor71);
a='outdoor71'
[stat_outdoor71_with_country_with_outdoor71] = image_check_result(gt_outdoor71,outdoor71_using_country_with_outdoor71, 1);
[stat_outdoor71_with_people_with_outdoor71] = image_check_result(gt_outdoor71,outdoor71_using_people_with_outdoor71, 1);
[stat_outdoor71_with_mix_with_outdoor71] = image_check_result(gt_outdoor71,outdoor71_using_mix_with_outdoor71, 1);

scenery07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.mat');
gt_scenery07=saved_data.saved_data{2};
[scenery07_using_country_with_scenery07]=image_labels(scenery07,models_struct_country_with_scenery07);
[scenery07_using_people_with_scenery07]=image_labels(scenery07,models_struct_people_with_scenery07);
[scenery07_using_mix_with_scenery07]=image_labels(scenery07,models_struct_mix_with_scenery07);
a='scenery07'
[stat_scenery07_with_country_with_scenery07] = image_check_result(gt_scenery07,scenery07_using_country_with_scenery07, 1);
[stat_scenery07_with_people_with_scenery07] = image_check_result(gt_scenery07,scenery07_using_people_with_scenery07, 1);
[stat_scenery07_with_mix_with_scenery07] = image_check_result(gt_scenery07,scenery07_using_mix_with_scenery07, 1);

urban8=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.mat');
gt_urban8=saved_data.saved_data{2};
[urban8_using_country_with_urban8]=image_labels(urban8,models_struct_country_with_urban8);
[urban8_using_people_with_urban8]=image_labels(urban8,models_struct_people_with_urban8);
[urban8_using_mix_with_urban8]=image_labels(urban8,models_struct_mix_with_urban8);
a='urban8'
[stat_urban8_with_country_with_urban8] = image_check_result(gt_urban8,urban8_using_country_with_urban8, 1);
[stat_urban8_with_people_with_urban8] = image_check_result(gt_urban8,urban8_using_people_with_urban8, 1);
[stat_urban8_with_mix_with_urban8] = image_check_result(gt_urban8,urban8_using_mix_with_urban8, 1);

streets01=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.mat');
gt_streets01=saved_data.saved_data{2};
[streets01_using_country_with_streets01]=image_labels(streets01,models_struct_country_with_streets01);
[streets01_using_people_with_streets01]=image_labels(streets01,models_struct_people_with_streets01);
[streets01_using_mix_with_streets01]=image_labels(streets01,models_struct_mix_with_streets01);
a='streets01'
[stat_streets01_with_country_with_streets01] = image_check_result(gt_streets01,streets01_using_country_with_streets01, 1);
[stat_streets01_with_people_with_streets01] = image_check_result(gt_streets01,streets01_using_people_with_streets01, 1);
[stat_streets01_with_mix_with_streets01] = image_check_result(gt_streets01,streets01_using_mix_with_streets01, 1);

[streets01_using_country_with_scenery07]=image_labels(streets01,models_struct_country_with_scenery07);
[stat_streets01_with_country_with_scenery07] = image_check_result(gt_streets01,streets01_using_country_with_scenery07, 1);

[urban8_using_country_with_scenery07]=image_labels(urban8,models_struct_country_with_scenery07);
[stat_urban8_with_country_with_scenery07] = image_check_result(gt_urban8,urban8_using_country_with_scenery07, 1);

[urban8_using_mix_with_scenery07]=image_labels(urban8,models_struct_mix_with_scenery07);
[stat_urban8_with_mix_with_scenery07] = image_check_result(gt_urban8,urban8_using_mix_with_scenery07, 1);







death_valley=imread('X:\Project\lit\cmu\structure3.jpg');
saved_data=open('X:\Project\lit\cmu\death_valley.mat');
gt_death_valley=saved_data.saved_data{2};
[death_valley_using_country]=image_labels(death_valley,models_struct_country);
[death_valley_using_people]=image_labels(death_valley,models_struct_people);
[death_valley_using_mix]=image_labels(death_valley,models_struct_mix);
a='death_valley'
[stat_death_valley_with_country] = image_check_result(gt_death_valley,death_valley_using_country, 1);
[stat_death_valley_with_people] = image_check_result(gt_death_valley,death_valley_using_people, 1);
[stat_death_valley_with_mix] = image_check_result(gt_death_valley,death_valley_using_mix, 1);

structure3=imread('X:\Project\lit\cmu\structure3.jpg');
[structure3_map,structure3_res,structure3_vote_per_reg_cell,structure3_confidence_cell]=image_labels(structure3,models_struct_mix);

structure6=imread('X:\Project\lit\cmu\structure6.jpg');
[structure6_map,structure6_res,structure6_vote_per_reg_cell,structure6_confidence_cell]=image_labels(structure6,models_struct_mix);


structure12=imread('X:\Project\lit\cmu\structure12.jpg');
[structure12_map,structure12_res,structure12_vote_per_reg_cell,structure12_confidence_cell]=image_labels(structure12,models_struct_mix);

structure16=imread('X:\Project\lit\cmu\structure16.jpg');
[structure16_map,structure16_res,structure16_vote_per_reg_cell,structure16_confidence_cell,structure16_seg_labels_table]=image_labels(structure16,models_struct_mix);

flat04=imread('X:\Project\lit\cmu\flat04.jpg');
[flat04_map,flat04_res,flat04_vote_per_reg_cell,flat04_confidence_cell]=image_labels(flat04,models_struct_mix);

[flat04_country_map,flat04_country_res,flat04_country_vote_per_reg_cell,flat04_country_confidence_cell]=image_labels(flat04,models_struct_country);

tic; [m2_country_map,m2_country_res,m2_country_vote_per_reg_cell,m2_country_confidence_cell]=image_labels(m2,models_struct_country); toc




mdir='D:\Technion\current semester\project A\for test';
zz=dir([mdir '\*.mat']);
str='';,for i=1:length(zz),str=sprintf('%s,''%s''',str,fullfile(mdir,zz(i).name));,end;,str(1)=[];

run parameters 
global model_p
model_p.class_func='FLD';
eval(sprintf(' [models_struct_FLD,raw_data_FLD,model_results,is_nan]=create_models_from_images(%s);',str))
run parameters 
global model_p
model_p.class_func='KNN';
eval(sprintf(' [models_struct_KNN,raw_data_KNN,model_results,is_nan]=create_models_from_images(%s);',str))
run parameters 
global model_p
model_p.class_func='RealAdaBoost';
eval(sprintf(' [models_struct_RealAdaBoost,raw_data_RealAdaBoost,model_results,is_nan]=create_models_from_images(%s);',str))
run parameters 
global model_p
model_p.class_func='ModestAdaBoost';
eval(sprintf(' [models_struct_ModestAdaBoost,raw_data_ModestAdaBoost,model_results,is_nan]=create_models_from_images(%s);',str))


mdir='D:\Technion\current semester\project A\Image Database - final\mix_dechiper_set';
zz=dir([mdir '\*.mat']);
str='';,for i=1:length(zz),str=sprintf('%s,''%s''',str,fullfile(mdir,zz(i).name));,end;,str(1)=[];
eval(sprintf(' [models_struct,raw_data,model_results,is_nan]=create_models_from_images(%s);',str))
clear model_results;

alley07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.mat');
gt_alley07=saved_data.saved_data{2};
[alley07_pics,alley07_stats]=check_image('alley07',alley07,gt_alley07,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);

beach02=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.mat');
gt_beach02=saved_data.saved_data{2};
[beach02_pics,beach02_stats]=check_image('beach02',beach02,gt_beach02,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);


cliff07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\cliff07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\cliff07.mat');
gt_cliff07=saved_data.saved_data{2};
[cliff07_pics,cliff07_stats]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);


outdoor71=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.mat');
gt_outdoor71=saved_data.saved_data{2};
[outdoor71_pics,outdoor71_stats]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);

scenery07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.mat');
gt_scenery07=saved_data.saved_data{2};
[scenery07_pics,scenery07_stats]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);

urban8=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.mat');
gt_urban8=saved_data.saved_data{2};
[urban8_pics,urban8_stats]=check_image('urban8',urban8,gt_urban8,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);

streets01=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.mat');
gt_streets01=saved_data.saved_data{2};
[streets01_pics,streets01_stats]=check_image('streets01',streets01,gt_streets01,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);


%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


mdir='D:\Technion\current semester\project A\Image Database - final\mix_dechiper_set';
zz=dir([mdir '\*.mat']);
str='';,for i=1:length(zz),str=sprintf('%s,''%s''',str,fullfile(mdir,zz(i).name));,end;,str(1)=[];
eval(sprintf(' [models_struct,raw_data,model_results,is_nan]=create_models_from_images(%s);',str))
clear model_results;

save 4_models

alley07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.mat');
gt_alley07=saved_data.saved_data{2};
[alley07_pics_FLD,alley07_stats_FLD]=check_image('alley07',alley07,gt_alley07,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[alley07_pics_KNN,alley07_stats_KNN]=check_image('alley07',alley07,gt_alley07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[alley07_pics_ModestAdaBoost,alley07_stats_ModestAdaBoost]=check_image('alley07',alley07,gt_alley07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[alley07_pics_RealAdaBoost,alley07_stats_RealAdaBoost]=check_image('alley07',alley07,gt_alley07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
save temp_result

beach02=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.mat');
gt_beach02=saved_data.saved_data{2};
[beach02_pics_FLD,beach02_stats_FLD]=check_image('beach02',beach02,gt_beach02,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[beach02_pics_KNN,beach02_stats_KNN]=check_image('beach02',beach02,gt_beach02,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[beach02_pics_ModestAdaBoost,beach02_stats_ModestAdaBoost]=check_image('beach02',beach02,gt_beach02,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[beach02_pics_RealAdaBoost,beach02_stats_RealAdaBoost]=check_image('beach02',beach02,gt_beach02,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
save temp_result

cliff07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\cliff07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\cliff07.mat');
gt_cliff07=saved_data.saved_data{2};
[cliff07_pics_FLD,cliff07_stats_FLD]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[cliff07_pics_KNN,cliff07_stats_KNN]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[cliff07_pics_ModestAdaBoost,cliff07_stats_ModestAdaBoost]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[cliff07_pics_RealAdaBoost,cliff07_stats_RealAdaBoost]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
save temp_result

outdoor71=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.mat');
gt_outdoor71=saved_data.saved_data{2};
[outdoor71_pics,outdoor71_stats]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);
[outdoor71_pics_FLD,outdoor71_stats_FLD]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[outdoor71_pics_KNN,outdoor71_stats_KNN]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[outdoor71_pics_ModestAdaBoost,outdoor71_stats_ModestAdaBoost]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[outdoor71_pics_RealAdaBoost,outdoor71_stats_RealAdaBoost]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
save temp_result

scenery07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.mat');
gt_scenery07=saved_data.saved_data{2};
[scenery07_pics,scenery07_stats]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);
[scenery07_pics_FLD,scenery07_stats_FLD]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[scenery07_pics_KNN,scenery07_stats_KNN]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[scenery07_pics_ModestAdaBoost,scenery07_stats_ModestAdaBoost]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[scenery07_pics_RealAdaBoost,scenery07_stats_RealAdaBoost]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
save temp_result

urban8=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.mat');
gt_urban8=saved_data.saved_data{2};
[urban8_pics,urban8_stats]=check_image('urban8',urban8,gt_urban8,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);
[urban8_pics_FLD,urban8_stats_FLD]=check_image('urban8',urban8,gt_urban8,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[urban8_pics_KNN,urban8_stats_KNN]=check_image('urban8',urban8,gt_urban8,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[urban8_pics_ModestAdaBoost,urban8_stats_ModestAdaBoost]=check_image('urban8',urban8,gt_urban8,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[urban8_pics_RealAdaBoost,urban8_stats_RealAdaBoost]=check_image('urban8',urban8,gt_urban8,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
save temp_result

streets01=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.mat');
gt_streets01=saved_data.saved_data{2};
[streets01_pics,streets01_stats]=check_image('streets01',streets01,gt_streets01,models_struct_country,models_struct_people,models_struct_building,models_struct_mix);
[streets01_pics_FLD,streets01_stats_FLD]=check_image('streets01',streets01,gt_streets01,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[streets01_pics_KNN,streets01_stats_KNN]=check_image('streets01',streets01,gt_streets01,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[streets01_pics_ModestAdaBoost,streets01_stats_ModestAdaBoost]=check_image('streets01',streets01,gt_streets01,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[streets01_pics_RealAdaBoost,streets01_stats_RealAdaBoost]=check_image('streets01',streets01,gt_streets01,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
save temp_result


str1='_pics_RealAdaBoost.image_using_country';
str2='_pics_RealAdaBoost.image_using_people';
str3='_pics_RealAdaBoost.image_using_building';
str4='_pics_RealAdaBoost.image_using_mix';
str5='gt_';

name='alley07';
%eval(sprintf(' figure; imagesc(%s);',name)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str1)); eval(sprintf(' figure; imagesc(%s%s);',name,str2)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str3)); eval(sprintf(' figure; imagesc(%s%s);',name,str4)); 
%eval(sprintf(' figure; imagesc(%s%s);',str5,name)); 

name='beach02';
%eval(sprintf(' figure; imagesc(%s);',name)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str1)); eval(sprintf(' figure; imagesc(%s%s);',name,str2)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str3)); eval(sprintf(' figure; imagesc(%s%s);',name,str4)); 
%eval(sprintf(' figure; imagesc(%s%s);',str5,name)); 

name='cliff07';
%eval(sprintf(' figure; imagesc(%s);',name)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str1)); eval(sprintf(' figure; imagesc(%s%s);',name,str2)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str3)); eval(sprintf(' figure; imagesc(%s%s);',name,str4)); 
%eval(sprintf(' figure; imagesc(%s%s);',str5,name)); 

name='outdoor71';
%eval(sprintf(' figure; imagesc(%s);',name)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str1)); eval(sprintf(' figure; imagesc(%s%s);',name,str2)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str3)); eval(sprintf(' figure; imagesc(%s%s);',name,str4)); 
%eval(sprintf(' figure; imagesc(%s%s);',str5,name)); 

name='scenery07';
%eval(sprintf(' figure; imagesc(%s);',name)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str1)); eval(sprintf(' figure; imagesc(%s%s);',name,str2)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str3)); eval(sprintf(' figure; imagesc(%s%s);',name,str4)); 
%eval(sprintf(' figure; imagesc(%s%s);',str5,name)); 

name='urban8';
%eval(sprintf(' figure; imagesc(%s);',name)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str1)); eval(sprintf(' figure; imagesc(%s%s);',name,str2)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str3)); eval(sprintf(' figure; imagesc(%s%s);',name,str4)); 
%eval(sprintf(' figure; imagesc(%s%s);',str5,name)); 

name='streets01';
%eval(sprintf(' figure; imagesc(%s);',name)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str1)); eval(sprintf(' figure; imagesc(%s%s);',name,str2)); 
eval(sprintf(' figure; imagesc(%s%s);',name,str3)); eval(sprintf(' figure; imagesc(%s%s);',name,str4)); 
%eval(sprintf(' figure; imagesc(%s%s);',str5,name)); 






run parameters 
global model_p
model_p.class_func='KNN';
[models_struct_country_KNN, is_nan] = create_models_struct( raw_data_country.input, raw_data_country.list_of_regions);
[models_struct_building_KNN, is_nan] = create_models_struct( raw_data_building.input, raw_data_building.list_of_regions);
[models_struct_people_KNN, is_nan] = create_models_struct( raw_data_people.input, raw_data_people.list_of_regions);
[models_struct_mix_KNN, is_nan] = create_models_struct( raw_data_mix.input, raw_data_mix.list_of_regions);

run parameters 
global model_p
model_p.class_func='RealAdaBoost';
[models_struct_country_RealAdaBoost, is_nan] = create_models_struct( raw_data_country.input, raw_data_country.list_of_regions);
[models_struct_building_RealAdaBoost, is_nan] = create_models_struct( raw_data_building.input, raw_data_building.list_of_regions);
[models_struct_people_RealAdaBoost, is_nan] = create_models_struct( raw_data_people.input, raw_data_people.list_of_regions);
[models_struct_mix_RealAdaBoost, is_nan] = create_models_struct( raw_data_mix.input, raw_data_mix.list_of_regions);

run parameters 
global model_p
model_p.class_func='ModestAdaBoost';
[models_struct_country_ModestAdaBoost, is_nan] = create_models_struct( raw_data_country.input, raw_data_country.list_of_regions);
[models_struct_building_ModestAdaBoost, is_nan] = create_models_struct( raw_data_building.input, raw_data_building.list_of_regions);
[models_struct_people_ModestAdaBoost, is_nan] = create_models_struct( raw_data_people.input, raw_data_people.list_of_regions);
[models_struct_mix_ModestAdaBoost, is_nan] = create_models_struct( raw_data_mix.input, raw_data_mix.list_of_regions);

%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

alley07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\alley07.mat');
gt_alley07=saved_data.saved_data{2};
beach02=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\beach02.mat');
gt_beach02=saved_data.saved_data{2};
cliff07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\cliff07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\cliff07.mat');
gt_cliff07=saved_data.saved_data{2};
outdoor71=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\outdoor71.mat');
gt_outdoor71=saved_data.saved_data{2};
scenery07=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\scenery07.mat');
gt_scenery07=saved_data.saved_data{2};
urban8=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\urban8.mat');
gt_urban8=saved_data.saved_data{2};
streets01=imread('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.jpg');
saved_data=open('D:\Technion\current semester\project A\Image Database - final\pics out of model\dechiper\streets01.mat');
gt_streets01=saved_data.saved_data{2};
save temp_result

% [alley07_pics_KNN,alley07_stats_KNN]=check_image('alley07',alley07,gt_alley07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
% [alley07_pics_ModestAdaBoost,alley07_stats_ModestAdaBoost]=check_image('alley07',alley07,gt_alley07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
% [alley07_pics_RealAdaBoost,alley07_stats_RealAdaBoost]=check_image('alley07',alley07,gt_alley07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
% save temp_result
% 
% [beach02_pics_KNN,beach02_stats_KNN]=check_image('beach02',beach02,gt_beach02,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
% [beach02_pics_ModestAdaBoost,beach02_stats_ModestAdaBoost]=check_image('beach02',beach02,gt_beach02,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
% [beach02_pics_RealAdaBoost,beach02_stats_RealAdaBoost]=check_image('beach02',beach02,gt_beach02,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
% save temp_result
% 
% [cliff07_pics_KNN,cliff07_stats_KNN]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
% [cliff07_pics_ModestAdaBoost,cliff07_stats_ModestAdaBoost]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
% [cliff07_pics_RealAdaBoost,cliff07_stats_RealAdaBoost]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
% save temp_result
% 
% [outdoor71_pics_KNN,outdoor71_stats_KNN]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
% [outdoor71_pics_ModestAdaBoost,outdoor71_stats_ModestAdaBoost]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
% [outdoor71_pics_RealAdaBoost,outdoor71_stats_RealAdaBoost]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
% save temp_result
% 
% [scenery07_pics_KNN,scenery07_stats_KNN]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
% [scenery07_pics_ModestAdaBoost,scenery07_stats_ModestAdaBoost]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
% [scenery07_pics_RealAdaBoost,scenery07_stats_RealAdaBoost]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
% save temp_result
% 
% [urban8_pics_KNN,urban8_stats_KNN]=check_image('urban8',urban8,gt_urban8,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
% [urban8_pics_ModestAdaBoost,urban8_stats_ModestAdaBoost]=check_image('urban8',urban8,gt_urban8,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
% [urban8_pics_RealAdaBoost,urban8_stats_RealAdaBoost]=check_image('urban8',urban8,gt_urban8,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
% save temp_result
% 
% [streets01_pics_KNN,streets01_stats_KNN]=check_image('streets01',streets01,gt_streets01,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
% [streets01_pics_ModestAdaBoost,streets01_stats_ModestAdaBoost]=check_image('streets01',streets01,gt_streets01,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
% [streets01_pics_RealAdaBoost,streets01_stats_RealAdaBoost]=check_image('streets01',streets01,gt_streets01,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
% save temp_result


run parameters 
global model_p
model_p.class_func='FLD';
[alley07_pics_FLD,alley07_stats_FLD]=check_image('alley07',alley07,gt_alley07,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[beach02_pics_FLD,beach02_stats_FLD]=check_image('beach02',beach02,gt_beach02,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[cliff07_pics_FLD,cliff07_stats_FLD]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[outdoor71_pics_FLD,outdoor71_stats_FLD]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[scenery07_pics_FLD,scenery07_stats_FLD]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[urban8_pics_FLD,urban8_stats_FLD]=check_image('urban8',urban8,gt_urban8,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
[streets01_pics_FLD,streets01_stats_FLD]=check_image('streets01',streets01,gt_streets01,models_struct_country_FLD,models_struct_people_FLD,models_struct_building_FLD,models_struct_mix_FLD);
save temp_result

run parameters 
global model_p
model_p.class_func='KNN';
[alley07_pics_KNN,alley07_stats_KNN]=check_image('alley07',alley07,gt_alley07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[beach02_pics_KNN,beach02_stats_KNN]=check_image('beach02',beach02,gt_beach02,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[cliff07_pics_KNN,cliff07_stats_KNN]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[outdoor71_pics_KNN,outdoor71_stats_KNN]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[scenery07_pics_KNN,scenery07_stats_KNN]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[urban8_pics_KNN,urban8_stats_KNN]=check_image('urban8',urban8,gt_urban8,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
[streets01_pics_KNN,streets01_stats_KNN]=check_image('streets01',streets01,gt_streets01,models_struct_country_KNN,models_struct_people_KNN,models_struct_building_KNN,models_struct_mix_KNN);
save temp_result

run parameters 
global model_p
model_p.class_func='RealAdaBoost';
[alley07_pics_RealAdaBoost,alley07_stats_RealAdaBoost]=check_image('alley07',alley07,gt_alley07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
[beach02_pics_RealAdaBoost,beach02_stats_RealAdaBoost]=check_image('beach02',beach02,gt_beach02,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
[cliff07_pics_RealAdaBoost,cliff07_stats_RealAdaBoost]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
[outdoor71_pics_RealAdaBoost,outdoor71_stats_RealAdaBoost]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
[scenery07_pics_RealAdaBoost,scenery07_stats_RealAdaBoost]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
[urban8_pics_RealAdaBoost,urban8_stats_RealAdaBoost]=check_image('urban8',urban8,gt_urban8,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
[streets01_pics_RealAdaBoost,streets01_stats_RealAdaBoost]=check_image('streets01',streets01,gt_streets01,models_struct_country_RealAdaBoost,models_struct_people_RealAdaBoost,models_struct_building_RealAdaBoost,models_struct_mix_RealAdaBoost);
save temp_result

run parameters 
global model_p
model_p.class_func='ModestAdaBoost';
[alley07_pics_ModestAdaBoost,alley07_stats_ModestAdaBoost]=check_image('alley07',alley07,gt_alley07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[beach02_pics_ModestAdaBoost,beach02_stats_ModestAdaBoost]=check_image('beach02',beach02,gt_beach02,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[cliff07_pics_ModestAdaBoost,cliff07_stats_ModestAdaBoost]=check_image('cliff07',cliff07,gt_cliff07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[outdoor71_pics_ModestAdaBoost,outdoor71_stats_ModestAdaBoost]=check_image('outdoor71',outdoor71,gt_outdoor71,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[scenery07_pics_ModestAdaBoost,scenery07_stats_ModestAdaBoost]=check_image('scenery07',scenery07,gt_scenery07,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[urban8_pics_ModestAdaBoost,urban8_stats_ModestAdaBoost]=check_image('urban8',urban8,gt_urban8,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
[streets01_pics_ModestAdaBoost,streets01_stats_ModestAdaBoost]=check_image('streets01',streets01,gt_streets01,models_struct_country_ModestAdaBoost,models_struct_people_ModestAdaBoost,models_struct_building_ModestAdaBoost,models_struct_mix_ModestAdaBoost);
save temp_result


[pics.image_using_country]=image_labels(image,models_struct_country_FLD);
[pics.image_using_people]=image_labels(image,models_struct_people_FLD);
[pics.image_using_building]=image_labels(image,models_struct_building_FLD);
[pics.image_using_mix]=image_labels(image,models_struct_mix_FLD);

run parameters 
global model_p
model_p.class_func='RealAdaBoost';

[pics2.image_using_country]=image_labels(image,models_struct_country_RealAdaBoost);
[pics2.image_using_people]=image_labels(image,models_struct_people_RealAdaBoost);
[pics2.image_using_building]=image_labels(image,models_struct_building_RealAdaBoost);
[pics2.image_using_mix]=image_labels(image,models_struct_mix_RealAdaBoost);






models_struct.fld1=models_struct_building_FLD;
models_struct.knn1=models_struct_building_KNN;
models_struct.RealAdaBoost1=models_struct_building_RealAdaBoost;
models_struct.ModestAdaBoost1=models_struct_building_ModestAdaBoost;
models_struct.fld2=models_struct_country_FLD;
models_struct.knn2=models_struct_country_KNN;
models_struct.RealAdaBoost2=models_struct_country_RealAdaBoost;
models_struct.ModestAdaBoost2=models_struct_country_ModestAdaBoost;
models_struct.fld3=models_struct_people_FLD;
models_struct.knn3=models_struct_people_KNN;
models_struct.RealAdaBoost3=models_struct_people_RealAdaBoost;
models_struct.ModestAdaBoost3=models_struct_people_ModestAdaBoost;
models_struct.fld4=models_struct_mix_FLD;
models_struct.knn4=models_struct_mix_KNN;
models_struct.RealAdaBoost4=models_struct_mix_RealAdaBoost;
models_struct.ModestAdaBoost4=models_struct_mix_ModestAdaBoost;

models1.RealAdaBoost1=models_struct_building_RealAdaBoost;
models1.RealAdaBoost2=models_struct_country_RealAdaBoost;
models1.RealAdaBoost3=models_struct_people_RealAdaBoost;
models1.RealAdaBoost4=models_struct_mix_RealAdaBoost;

models2.RealAdaBoost1=models_struct_building_RealAdaBoost;
models2.RealAdaBoost2=models_struct_country_RealAdaBoost;
models2.RealAdaBoost3=models_struct_people_RealAdaBoost;
models2.RealAdaBoost4=models_struct_mix_RealAdaBoost;
models2.fld1=models_struct_building_FLD;
models2.fld2=models_struct_country_FLD;
models2.fld3=models_struct_people_FLD;
models2.fld4=models_struct_mix_FLD;
models2.knn1=models_struct_building_KNN;
models2.knn2=models_struct_country_KNN;
models2.knn3=models_struct_people_KNN;
models2.knn4=models_struct_mix_KNN;
tic;
str='alley07';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct);',str,str));
eval(sprintf(' figure; imagesc(%s);',str)); eval(sprintf(' figure; imagesc(pic_%s);',str));
eval(sprintf('[stats_%s] = image_check_result(gt_%s,pic_%s, 1);',str,str,str));
toc
tic;
str='beach02';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct);',str,str)); toc
eval(sprintf(' figure; imagesc(%s);',str)); eval(sprintf(' figure; imagesc(pic_%s);',str,str));
eval(sprintf('[stats_%s] = image_check_result(gt_%s,pic_%s, 1);',str,str,str));
toc
tic;
str='cliff07';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct);',str,str));
eval(sprintf(' figure; imagesc(%s);',str)); eval(sprintf(' figure; imagesc(pic_%s);',str,str));
eval(sprintf('[stats_%s] = image_check_result(gt_%s,pic_%s, 1);',str,str,str));
toc
tic;
str='outdoor71';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct);',str,str));
eval(sprintf(' figure; imagesc(%s);',str)); eval(sprintf(' figure; imagesc(pic_%s);',str,str));
eval(sprintf('[stats_%s] = image_check_result(gt_%s,pic_%s, 1);',str,str,str));
toc
tic;
str='scenery07';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct);',str,str));
eval(sprintf(' figure; imagesc(%s);',str)); eval(sprintf(' figure; imagesc(pic_%s);',str,str));
eval(sprintf('[stats_%s] = image_check_result(gt_%s,pic_%s, 1);',str,str,str));
toc
tic;
str='urban8';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct);',str,str));
eval(sprintf(' figure; imagesc(%s);',str)); eval(sprintf(' figure; imagesc(pic_%s);',str,str));
eval(sprintf('[stats_%s] = image_check_result(gt_%s,pic_%s, 1);',str,str,str));
toc
tic;
str='streets01';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct);',str,str));
eval(sprintf(' figure; imagesc(%s);',str)); eval(sprintf(' figure; imagesc(pic_%s);',str));
eval(sprintf('[stats_%s] = image_check_result(gt_%s,pic_%s, 1);',str,str,str));
toc

str='alley07';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct_mix_RealAdaBoost);',str,str));
str='beach02';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct_mix_RealAdaBoost);',str,str));
str='cliff07';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct_mix_RealAdaBoost);',str,str));
str='outdoor71';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct_mix_RealAdaBoost);',str,str));
str='scenery07';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct_mix_RealAdaBoost);',str,str));
str='urban8';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct_mix_RealAdaBoost);',str,str));
str='streets01';
eval(sprintf('[pic_%s]=image_labels(%s,models_struct_mix_RealAdaBoost);',str,str));

str='alley07';
eval(sprintf('[grade]=segment_grades(pic_%s)',str));
eval(sprintf('[stas]=image_check_result(gt_%s,pic_%s.segment_labels_map,1);',str,str));
str='beach02';
eval(sprintf('[grade]=segment_grades(pic_%s)',str));
eval(sprintf('[stas]=image_check_result(gt_%s,pic_%s.segment_labels_map,1);',str,str));
str='cliff07';
eval(sprintf('[grade]=segment_grades(pic_%s)',str));
eval(sprintf('[stas]=image_check_result(gt_%s,pic_%s.segment_labels_map,1);',str,str));
str='outdoor71';
eval(sprintf('[grade]=segment_grades(pic_%s)',str));
eval(sprintf('[stas]=image_check_result(gt_%s,pic_%s.segment_labels_map,1);',str,str));
str='scenery07';
eval(sprintf('[grade]=segment_grades(pic_%s)',str));
eval(sprintf('[stas]=image_check_result(gt_%s,pic_%s.segment_labels_map,1);',str,str));
str='urban8';
eval(sprintf('[grade]=segment_grades(pic_%s)',str));
eval(sprintf('[stas]=image_check_result(gt_%s,pic_%s.segment_labels_map,1);',str,str));
str='streets01';
eval(sprintf('[grade]=segment_grades(pic_%s)',str));
eval(sprintf('[stas]=image_check_result(gt_%s,pic_%s.segment_labels_map,1);',str,str));

%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mdir='D:\Technion\current semester\project A\Image Database - final\temp'
files=dir([mdir '\*.jpg']);
for i=1:length(files)
    names{i}=files(i).name;
end
str_dir='D:\Technion\current semester\project A\Image Database - final\temp\';
for i=1:length(files)
    str=names{i};
    im=imread(sprintf('%s%s',str_dir,str));
    [data]=image_labels(im,models_struct_mix_RealAdaBoost);
    eval(sprintf('data_%s.segment_labels_map=data.segment_labels_map;',str));
    eval(sprintf('data_%s.res.seg_indices=data.res.seg_indices;',str));
    eval(sprintf('data_%s.seg_labels_tables=data.seg_labels_tables;',str));
    eval(sprintf('[grade_%s]=segment_grades(data_%s);',str,str));
    clear data
end
clear str str_dir names mdir im i files
save temp_results


for i=1:31
    str=names{i};
    im=imread(sprintf('%s%s',str_dir,str));
    eval(sprintf('grade=grade_%s;',str));
    grade=grade*100;
    figure; imagesc(im); title(sprintf('grade_%s = %2.2f',str,grade));
    eval(sprintf('figure; imagesc(data_%s.segment_labels_map);',str)); title(sprintf('grade_%s = %2.2f',str,grade));
end

for i=31:63
    str=names{i};
    im=imread(sprintf('%s%s',str_dir,str));
    eval(sprintf('grade=grade_%s;',str));
    grade=grade*100;
    figure; imagesc(im); title(sprintf('grade_%s = %2.2f',str,grade));
    eval(sprintf('figure; imagesc(data_%s.segment_labels_map);',str)); title(sprintf('grade_%s = %2.2f',str,grade));
end



i=1;
close all
str1='pic_real_building_';
str11='pic-real-building-';
str2='pic_real_country_';
str21='pic-real-country-';
str3='pic_real_people_';
str31='pic-real-people-';
str4='pic_real_mix_';
str41='pic-real-mix-';
str5='pic_4ada_';
str51='pic-4ada-';
str6='pic_4mix_';
str61='pic-4mix-';
str_dir='D:\Technion\current semester\project A\Image Database - final\temp\';
str=names{i};
im=imread(sprintf('%s%s',str_dir,str));
eval(sprintf('figure; imagesc(im);',str)); title(sprintf('%s',str));
eval(sprintf('figure; imagesc(%s%s.segment_labels_map);',str1,str)); title(sprintf('%s',[str11 str]));
eval(sprintf('figure; imagesc(%s%s.segment_labels_map);',str2,str)); title(sprintf('%s%s',str21,str));
eval(sprintf('figure; imagesc(%s%s.segment_labels_map);',str3,str)); title(sprintf('%s%s',str31,str));
eval(sprintf('figure; imagesc(%s%s.segment_labels_map);',str4,str)); title(sprintf('%s%s',str41,str));
eval(sprintf('figure; imagesc(%s%s.segment_labels_map);',str5,str)); title(sprintf('%s%s',str51,str));
eval(sprintf('figure; imagesc(%s%s.segment_labels_map);',str6,str)); title(sprintf('%s%s',str61,str));


mdir='D:\Technion\current semester\project A\Image Database - final\pics out of model'
files=dir([mdir '\*.mat']);
for i=1:length(files)
    names{i}=files(i).name;
end
temp='\';
str_dir='D:\Technion\current semester\project A\Image Database - final\pics out of model2';
for i=1:length(files)
    str=names{i};
    name=str(1:end-4);
    load (sprintf('%s%s%s',str_dir,temp,str));
    im=saved_data{3,1};
    run parameters 
    global model_p
    model_p.class_func='FLD';
    eval(sprintf('[data_%s.FLD]=image_labels(im,models_struct_mix_FLD);',name));
    eval(sprintf('data_%s.gt=saved_data{2,1};',name));

    tic;
    run parameters
    global model_p
    model_p.class_func='KNN';
    eval(sprintf('[data_%s.KNN]=image_labels(im,models_struct_mix_KNN);',name));
toc
    run parameters
    global model_p
    model_p.class_func='RealAdaBoost';
    eval(sprintf('[data_%s.RealAdaBoost]=image_labels(im,models_struct_mix_RealAdaBoost);',name));

    run parameters
    global model_p
    model_p.class_func='ModestAdaBoost';
    eval(sprintf('[data_%s.ModestAdaBoost]=image_labels(im,models_struct_mix_ModestAdaBoost);',name));
   
end

    
classifiyers{1}='FLD';
classifiyers{2}='KNN';
classifiyers{3}='RealAdaBoost';
classifiyers{4}='ModestAdaBoost';
for k=1:4
    class_func=classifiyers{k};
    system_score=0;
    clear gt_cell
    clear label_cell
    mdir='D:\Technion\current semester\project A\Image Database - final\pics out of model'
    files=dir([mdir '\*.mat']);
    for i=1:length(files)
        names{i}=files(i).name;
    end
    for i=1:length(files)
        str=names{i};
        name=str(1:end-4);
        eval(sprintf('gt_cell{%d}= data_%s.gt;',i,name));
        eval(sprintf('label_cell{%d}= data_%s.%s.segment_labels_map;',i,name,class_func));
        eval(sprintf('system_score=system_score+ (data_%s.%s.labeling_grade > 0.85);',name,class_func));
        eval(sprintf('system_score_arr(k,i)=data_%s.%s.labeling_grade;',name,class_func));
    end

    sprintf('these are results for the classifiyer - %s',class_func)
    [statistics] = image_check_result_batch(label_cell, gt_cell, 1 , 1, 1)
    sprintf('label 1 score is - %2.2f',(statistics.tru_pct_1+statistics.tru_vote_pct_1)/0.02)
    sprintf('label 2 score is - %2.2f',(statistics.tru_pct_2+statistics.tru_vote_pct_2)/0.02)
    sprintf('label 3 score is - %2.2f',(statistics.tru_pct_3+statistics.tru_vote_pct_3)/0.02)
    sprintf('label 4 score is - %2.2f',(statistics.tru_pct_4+statistics.tru_vote_pct_4)/0.02)
    
    sprintf('the GT average score is - %2.2f',(statistics.tru_total_pct+statistics.tru_total_vote_pct)/0.02)
    sprintf('the system average score is - %2.2f',100*(system_score/i))
    
end


temp='\'
    for i=1:length(files)
        str=names{i};
        name=str(1:end-4);
        load (sprintf('%s',[mdir temp str]));
        im=saved_data{3,1};
        eval(sprintf('figure; imagesc(im);',str)); title(sprintf('%s',name));
%         eval(sprintf('figure; imagesc(data_%s.FLD.segment_labels_map);',name)); 
%         title(sprintf('%s - %2.2f',name, eval(sprintf('100*data_%s.FLD.labeling_grade',name))));
%        eval(sprintf('figure; imagesc(data_%s.KNN.segment_labels_map);',name)); pixval;
%        title(sprintf('%s - %2.2f',name, eval(sprintf('100*data_%s.KNN.labeling_grade',name))));
%         eval(sprintf('figure; imagesc(data_%s.RealAdaBoost.segment_labels_map);',name));pixval;
 %        title(sprintf('%s - %2.2f',name, eval(sprintf('100*data_%s.RealAdaBoost.labeling_grade',name))));
         eval(sprintf('figure; imagesc(data_%s.ModestAdaBoost.segment_labels_map);',name));pixval;
         title(sprintf('%s - %2.2f',name, eval(sprintf('100*data_%s.ModestAdaBoost.labeling_grade',name))));
   end